<%--                                                                       --%>
<%-- Copyright (c) 2001-2004 BroadVision, Inc.  All rights reserved.       --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries.                       --%>
<%--                                                                       --%>
<%@ page language="java" %>
<%@ page import = "org.apache.struts.util.LabelValueBean" %>

<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/bv-html.tld" prefix="bvhtml" %>

  <!-- start javascript functions here.  -->
  <script language="javascript">
  <!--
    function onClickStartCollaboration() {
	  if (validateForm()) {
	    document.micrositeSetupEditForm.submit();
	  }
	}
	
	function onClickButton(theForm, url) {
	  if (validateForm()) {
	    theForm.action = url;
	    theForm.submit();
	  }
	}

    //
    // Trims leading blanks.
    //
    function stringLeftTrim(s) {
      return s.replace(/^ +/, "");
    }

    //
    // Trims trailing blanks.
    //
    function stringRightTrim(s) {
      return s.replace(/ +$/, "");
    }

    //
    // Trims leading and trailing blanks.
    //
    function stringTrim(s) {
      return stringRightTrim(stringLeftTrim(s));
    }

    //
    // Validate the user's entries.
    //
    function validateForm() {

      var msg = stringTrim(document.micrositeSetupEditForm.message.value);
      if (msg == "") {
        alert("<bean:message key="cs.error.participant.notify.message"/>");
        return false;
      }

      var subject = stringTrim(document.micrositeSetupEditForm.subject.value);
      if (subject == "") {
        alert("<bean:message key="cs.error.participant.notify.subject"/>");
        return false;
      }

      var name = stringTrim(document.micrositeSetupEditForm.name.value);
      if (name == "") {
        alert("<bean:message key="cs.error.collaboration.name"/>");
        return false;
      }
      return true;
	}

    function onClickReset() {
      document.micrositeSetupEditForm.reset();
    }

  // -->
  </script>
  <!-- End javascript functions here.  -->
  
  <!-- Zone 5 starts here.  -->
  <table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0"
      summary='<bean:message key="cs.collaboration.setup.table.summary1"/>' >
    <tr>
      <td valign="top" width="100%">
  <!--start page title area here-->
        <div class="pageTitle">
          <bean:message key="cs.collaboration.setup.pageTitle"/>
        </div>
  <!--end page title area here-->
  <!--start page instructions area here-->
        <div class="pageInstructions">
          <logic:equal name="micrositeSetupView" property="displaySetupButton" value="true">
          <bean:message key="cs.collaboration.setup.pageInstructions" />
          </logic:equal>
          <logic:notEqual name="micrositeSetupView" property="displaySetupButton" value="true">
          <bean:message key="cs.collaboration.setup.pageInstrDisabled" />
          </logic:notEqual>
        </div>
  <!--end notification instructions area here-->
  <!--start page subtitle area here-->
        <div class="pageSubtitle">
	      <span class="left">
	      <bean:message key="cs.participants.notify.title"/>
	      </span>
		  <span class="right">&nbsp;</span>
        </div> 
  <!--end page subtitle area here-->

  <div class="blockWrap">  
     
  <!--start notification instructions area here-->
        <div class="pageInstructions">
        <bean:message key="cs.collaboration.setup.notificationInstructions" />
        </div>
  <!--end notification instructions area here-->

  <!--start setup collaboration form here-->
    <html:form action="/cs/startCollaboration.do">
    <bvhtml:hiddenList name="micrositeNaviInfoView" property="urlParams" 
                                                        scope="request"/>
  <!--start notification message table area here-->
        <table class="labelForm" width="100%" border="0" 
          cellspacing="0" cellpadding="0" 
          summary='<bean:message key="cs.participants.notify.table.summary"/>'>
          <tr> 
            <td class="label" width="15%">
              <bean:message key="cs.participants.notify.subject"/>*:
            </td>
            <td class="labelField" width="85%">
              <html:text property="subject" size="70" maxlength="80"/>
            </td>
          </tr>
          <tr> 
            <td class="label" width="15%">
              <bean:message key="cs.participants.notify.message"/>*:
            </td>
            <td class="labelField" width="85%">
              <html:textarea property="message" cols="70" rows="15"/>
            </td>
          </tr>
        </table>
  <!--end notification message table area here-->
       </div>
       <div class="blockWrap">
        
  <!--start page collaboration subtitle area here-->
        <div class="pageSubtitle">
          <span class="left">
            <bean:message key="cs.collaboration.setup.pageSubtitle"/>
          </span>
          <span class="right">&nbsp;</span>
        </div> 
  <!--end page title area here-->

  <!--start collaboration space information table area here-->
        <table class="labelForm" width="100%" border="0" 
          cellspacing="0" cellpadding="0" 
          summary='<bean:message key="cs.collaboration.setup.pageSubtitle"/>'>

          <tr> 
            <td class="label" width="15%">
            <bean:message key="cs.name"/>:
            </td>
            <td class="labelField" width="85%">
              <html:text property="name" size="40" maxlength="80"/>
            </td>
          </tr>
          <tr> 
            <td class="label" width="15%">
            <bean:message key="cs.description"/>:
            </td>
            <td class="labelField" width="85%">
              <html:textarea property="description" cols="40" rows="5"/>
            </td>
          </tr>
          <tr> 
            <td class="label" width="15%">
              <bean:message key="cs.participants"/>:
            </td>
            <td class="labelField" width="85%">
              <logic:iterate id="oneParticipant" name="micrositeSetupView"
                property="participants" indexId="index" type="LabelValueBean">
                <bean:write name="oneParticipant" property="label" />
                <logic:greaterThan name="micrositeSetupView" property="participantsCount" 
                  value="<%=String.valueOf(index.intValue() + 1)%>">
                , <br>
                </logic:greaterThan>
              </logic:iterate>
            </td>
          </tr>
          <tr> 
            <td class="label" width="15%">
              <bean:message key="cs.accessGroups"/>:
            </td>
            <td class="labelField" width="85%">
              <logic:iterate id="oneGroup" name="micrositeSetupView" 
                property="groups" type="LabelValueBean" indexId="index">
                <bean:write name="oneGroup" property="label" />
                <logic:greaterThan name="micrositeSetupView" property="groupsCount" 
                  value="<%=String.valueOf(index.intValue() + 1)%>">
                , <br>
                </logic:greaterThan>
              </logic:iterate>
            </td>
          </tr>
          <tr> 
            <td class="label" width="15%">
              <bean:message key="cs.discussions"/>:
            </td>
            <td class="labelField" width="85%">
              <logic:iterate id="oneDiscussion" name="micrositeSetupView"
                property="discussionGroups" indexId="index">
                <bean:write name="oneDiscussion" property="name" />
                <logic:greaterThan name="micrositeSetupView" property="discussionsCount" 
                  value="<%=String.valueOf(index.intValue() + 1)%>">
                , <br>
                </logic:greaterThan>
              </logic:iterate>
            </td>
          </tr>
        </table>

  <!-- Start folders list here -->
        <table class="dataTable" border="0" cellspacing="1" cellpadding="2" 
               width="100%" summary='<bean:message key="cs.phases.all"/>' >

          <tr class="listHeader"> 
            <th id="PhaseName" align="left">
              <bean:message key="cs.phases"/>
            </th>
            <th id="Folders" align="left">
              <bean:message key="cs.folders"/>
            </th>
          </tr>
          <logic:iterate id="onePhase" name="micrositeSetupView"
                                property="phasesAndFolders" indexId="index" >

            <tr class='<%=index.intValue() % 2 == 0 ? "listEven" : "listOdd"%>'> 
              <td headers="PhaseName">
                <bean:write name="onePhase" property="phaseName"/>
              </td>    
              <td headers="Folders">
                <logic:iterate id="oneFolder" name="onePhase"
                              property="folders" indexId="indexFolders">
                  <bean:write name="oneFolder" property="name"/>
                <logic:greaterThan name="onePhase" property="foldersCount" 
                  value="<%=String.valueOf(indexFolders.intValue() + 1)%>">
                , <br>
                </logic:greaterThan>
                </logic:iterate>
              </td>
            </tr>
          </logic:iterate>
        </table>
  <!-- End folders list here -->

  <!-- Start reset, cancel, save, start collaboration buttons here -->
        <div class="pageButtonWrap" align="right">
          <input hspace="40" type="button" class="pageButton" name="resetBtn"
                 value='<bean:message key="button.reset"/>'
                 titleKey="button.reset"
                 onclick="onClickReset()">
          <input hspace="40" type="button" class="pageButton" name="cancelBtn"
                      value='<bean:message key="button.cancel"/>'
                      titleKey="button.cancel"
                      onclick="return history.back()">&nbsp;&nbsp; 
	                   
	      <input hspace="40" type="button" class="pageButton" name="saveBtn"
	             value='<bean:message key="button.save"/>'
	             titleKey="button.save"
	             onclick="onClickButton(this.form, '<html:rewrite page="/cs/saveCollaboration.do"/>')">

          <logic:equal name="micrositeSetupView" property="displaySetupButton" value="true">
            <input hspace="40" type="button"  class="pageButton" name="startBtn"
               titleKey="cs.microsite.start.button" onclick="onClickStartCollaboration()"
               value='<bean:message key="cs.microsite.start.button"/>'>

          </logic:equal>
          <logic:notEqual name="micrositeSetupView" property="displaySetupButton" value="true">
            <input hspace="40" type="button"  class="disabledButton" name="disabledStartBtn"
               titleKey="cs.microsite.start.button" 
               value='<bean:message key="cs.microsite.start.button"/>'>

          </logic:notEqual>
		</div>
  <!-- End reset, cancel, save, start collaboration buttons here -->

    </html:form>
  <!-- end form here -->
     
     </div>

     </td>
    </tr>
  </table>
  <!--end zone 5 content here -->		  

